package job;

import sun.plugin.net.protocol.jar.CachedJarURLConnection;

import java.util.*;

/**
 * @author wq
 * 字符串统计
 */
public class SheIn {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s=in.nextLine();

        Map<Character,Integer> map=new HashMap<Character,Integer>();

        for(int i=0;i<s.length();i++){
            char ch=s.charAt(i);
            if(map.containsKey(ch)){
               map.put(ch,map.get(ch)+1);
            }else{
                map.put(ch,1);
            }
        }


        List<Map.Entry<Character,Integer>> list=new ArrayList<>(map.entrySet());
        Collections.sort(list, new Comparator<Map.Entry<Character, Integer>>() {
            @Override
            public int compare(Map.Entry<Character, Integer> o1, Map.Entry<Character, Integer> o2) {
                if(o1.getValue()==o2.getValue()){
                    return o1.getKey()-o2.getKey();
                }else{
                    return o1.getValue()-o2.getValue();
                }
            }
        });

        for(Map.Entry<Character,Integer> entry:list){
            System.out.println(entry.getKey()+ " "+ entry.getValue());
        }

    }
}
